#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n, a[101], ans = 0, sum = 0;
	cin>>n;
	for(int i = 0; i < n; i++)
	{
		cin>>a[i];
		sum += a[i];
	} 
	sum /= n;
	for(int i = 0; i < n; i++) 
		a[i] -= sum;
	for(int i = 0; i < n; i++)
	{
		if(a[i] != 0)
		{
			a[i+1] += a[i];
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}
